SwitchLamp
Switches the LEGO lamp on or off (has to be connected to a motor port)
Contents
Syntax
SwitchLamp(port, mode)
SwitchLamp(port, mode, handle)
Description
SwitchLamp(port, mode) turns the LEGO lamp on or off. The given port number specifies the used motor port. The value port can be addressed by the symbolic constants MOTOR_A , MOTOR_B and MOTOR_C analog to the labeling on the NXT Brick. The value mode supports two modes 'on' and 'off' to turn the lamp on and off.
The last optional argument can be a valid NXT handle. If none is specified, the default handle will be used (call COM_SetDefaultNXT to set one).
This function simply sets power 100 to the specified motor port to turn on the lamp, or sets power 0 to turn it off. Note that dimming is not possible, even a power of just 1 will be enough to switch the lamp to full brightness (after a short while).
A StopMotor command with parameter 'off' will also turn off the lamp, but it is recommended to use this function when working with lamps for better readability.
Examples
|SwitchLamp(MOTOR_B, 'on');|
|SwitchLamp(MOTOR_A, 'off');|
See also
SetPower, SendMotorSettings, StopMotor, MOTOR_A, MOTOR_B, MOTOR_C
Signature
- Author: Linus Atorf, Alexander Behrens (see AUTHORS)
- Date: 2007/10/15
- Copyright: 2007-2008, RWTH Aachen University